﻿<%@ control language="C#" autoeventwireup="true" inherits="_modules_ucAmcDetails, App_Web_uortujqs" %>

<div class="addCustomerFormContainer">
        <div class="addCustomerFormRowText" style="margin-top:10px;">
            AMC Details
            </div>
        <div class="addCustomerFormRow">
            <span class="addCustomerFormText"><span style="color:Red;">*</span>Invoice No.</span>
            <div class="addCustomerFormInputDiv"><input id="txtAmcInvoiceNo" disabled="disabled" type="text" class="addCustomerFormInput" /></div>
            </div>  
        <div class="addCustomerFormRow">
            <span class="addCustomerFormText"><span style="color:Red;">*</span>Invoice Date</span>
            <div class="addCustomerFormInputDiv"><input id="txtInvoiceDt" type="text" class="addCustomerFormInput" disabled="disabled" />
            </div>
        </div>          
        <div class="addCustomerFormRow">
            <span class="addCustomerFormText"><span style="color:Red;">*</span>Warranty From</span>
            <div class="addCustomerFormInputDiv"><input id="txtWarrantyFrom" type="text" class="addCustomerFormInput" />
            </div>
            <%--<span class="addCustomerFormText">Warranty</span>
            <div class="addCustomerFormInputDiv">
            <select id="selWarrantyPeriod" class="addCustomerFormInput" onchange="onChangeWarranty();">
                    <option value="0" selected="selected">Please Select</option>
                    <option value="1">1 Year</option>
                    <option value="2">2 Years</option>
                    <option value="3">3 Years</option>
                    <option value="4">4 Years</option>
                    <option value="5">5 Years</option>
                </select>
            </div>--%>
        </div>
        <div class="addCustomerFormRow">
            <span class="addCustomerFormText">Expiry Date</span>
            <div class="addCustomerFormInputDiv"><input id="expiryDate" type="text" class="addCustomerFormInput"/></div>
            <span id="validityPeriod" class="addCustomerFormText" style="font-weight:600; width:300px;"></span>
        </div> 
        <div class="addCustomerFormRow">
        <span class="addCustomerFormText">Payment Mode</span>
            <div class="addCustomerFormInputDiv">
                <input type="radio" id="rbtnCash" name="paymode" value="Cash" class="formRadioBtn" checked="checked" />
                <label for="rbtnCash" class="formRadioLabel">Cash</label>
                <input type="radio" id="rbtnCheque" name="paymode" value="Cheque" class="formRadioBtn" />
                <label for="rbtnCash" class="formRadioLabel">Cheque</label>
                <input type="radio" id="rbtnOthers" name="paymode" value="Others" class="formRadioBtn" />
                <label for="rbtnCash" class="formRadioLabel">Others</label>
            </div>
        </div>
        <div class="addCustomerFormRow">
            <span class="addCustomerFormText">AMC Rate</span>
            <div class="addCustomerFormInputDiv"><input id="txtAMCRate" type="text" class="addCustomerFormInput" />
            <span style="color: #ABABAB;float: left;font-size: 10px;">Enter the AMC rate for one year</span>
            </div>
        </div>
    </div>
    <div class="addCustomerFormButtonContainer" style="width:95%;margin-right: 30px;">
        <div class="adminColorButton" style="float:right;" onclick="saveAMCDetails();">Save & Preview</div>
        <div class="adminGrayButton" style="float:right;">Cancel</div>
    </div>
<asp:HiddenField ID="hidAMCGuid" runat="server" />
<script type="text/javascript">
    $(document).ready(function () {
        $('#txtAmcInvoiceNo').val(genDynmID());
        $('#txtInvoiceDt').datepicker({ dateFormat: "mm/dd/yy" }).datepicker("setDate", new Date());
        $('#txtWarrantyFrom').datepicker({ changeYear: true, changeMonth: true, dateFormat: "mm/dd/yy" }).datepicker("setDate", new Date());
        $('#expiryDate').datepicker({ changeYear: true, changeMonth: true, dateFormat: "mm/dd/yy", onSelect: function () {
            var d1 = new Date($('#txtWarrantyFrom').val()); // January 1st 2010
            var d2 = new Date($('#expiryDate').val()); // February 1st 2010
            var diff = d2 - d1;
            var daysRemaining = diff / 1000 / 60 / 60 / 24;
            $('#validityPeriod').text("Valid for " + daysRemaining + " days");
        }
        });
        disableTextbox();
    });
    function onChangeWarranty() {
        var warnty = $('#selWarrantyPeriod').val();
        var wardate = $('#txtAMCInvoiceDate').val();
        var d = wardate.split('/');
        var yy = parseInt(d[2]) + parseInt(warnty);
        $('#expiryDate').val(d[0] + "/" + d[1] + "/" + yy);

    }
</script>